import requests
import json
import re
import os
import sys

cwd = os.getcwd()
sys.path.append(cwd)
print(cwd)

from pub_func import DownloadFile, file_readlines

headers = {
    'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36',
}


if __name__ == '__main__':
    count = 0
    file_path = '/home/ubuntu/workspace/img/yitubao_8.csv'
    dir_path = '/media/ubuntu/08f29263-3882-43db-96fd-febb6f2e2e5f/天气/yitubao.com/降雪'
    list_img_url = file_readlines(file_path)
    for img_url in list_img_url[:550]:
        count += 1
        img_name = str(count) + '.jpg'
        print(img_name)
        DownloadFile(img_url[:-2], dir_path, img_name)